<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript更改HTML元素的内容</title>
</head>
<body>
<button type="button" onclick="oneFunction()">更改内容</button>
<p id="demo">旧内容</p>
<script>
  function oneFunction(){
    document.getElementById("demo").innerHTML="新内容"
  }
</script>
</body>
</html>